import { GTweener } from "./GTweener";
import { TweenHelper } from "./TweenHelper";

export class GTween {
    public static catchCallbackExceptions: boolean = true;

    public static to(start: number, end: number, duration: number): GTweener {
        return TweenHelper.createTween()._to(start, end, duration);
    }

    public static to2(start: number, start2: number, end: number, end2: number, duration: number): GTweener {
        return TweenHelper.createTween()._to2(start, start2, end, end2, duration);
    }

    public static to3(start: number, start2: number, start3: number,
        end: number, end2: number, end3: number, duration: number): GTweener {
        return TweenHelper.createTween()._to3(start, start2, start3, end, end2, end3, duration);
    }

    public static to4(start: number, start2: number, start3: number, start4: number,
        end: number, end2: number, end3: number, end4: number, duration: number): GTweener {
        return TweenHelper.createTween()._to4(start, start2, start3, start4, end, end2, end3, end4, duration);
    }
    public static toVec2(start: IVector2Like, end: IVector2Like, duration: number): GTweener {
        return this.to2(start.x, start.y, end.x, end.y, duration);
    }
    public static toVec3(start: IVector3Like, end: IVector3Like, duration: number): GTweener {
        return this.to3(start.x, start.y, start.z, end.x, end.y, end.z, duration);
    }
    public static toVec4(start: IVector4Like, end: IVector4Like, duration: number): GTweener {
        return this.to4(start.x, start.y, start.z, start.z, end.x, end.y, end.z, end.w, duration);
    }
    public static toColor(start: number, end: number, duration: number): GTweener {
        return TweenHelper.createTween()._toColor(start, end, duration);
    }

    public static delayedCall(delay: number): GTweener {
        return TweenHelper.createTween().setDelay(delay);
    }

    public static shake(startX: number, startY: number, amplitude: number, duration: number): GTweener {
        return TweenHelper.createTween()._shake(startX, startY, amplitude, duration);
    }

    public static isTweening(target: any, propType?: any): Boolean {
        return TweenHelper.isTweening(target, propType);
    }

    public static kill(target: any, complete?: boolean, propType?: any): void {
        TweenHelper.killTweens(target, complete, propType);
    }

    public static getTween(target: any, propType?: any): GTweener {
        return TweenHelper.getTween(target, propType);
    }
}
interface IVector2Like {
    x: number, y: number
}
interface IVector3Like {
    x: number, y: number, z: number
}
interface IVector4Like {
    x: number, y: number, z: number, w: number
}